let path = require('path')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
function resolve(dir) {
    return path.join(__dirname, dir)
}
module.exports = {
    lintOnSave: false,
    publicPath: '/',
    devServer: {
        host: '0.0.0.0',
        proxy: {
            '/community': {
                target: 'http://47.103.69.233:8199',
                ws: true,
                changeOrigin: true,
            }
        },
        allowedHosts: [
            'aliyuncs.com'
        ],
        disableHostCheck: true // 添加这一行
    },
    configureWebpack: {
        optimization: {
            minimizer: [
                new UglifyJsPlugin({
                    uglifyOptions: {
                        compress: {
                            // warnings: false,
                            drop_console: true, //注释console
                            drop_debugger: false,
                            pure_funcs: ['console.log'] //移除console
                        }
                    }
                })
            ]
        }
    },
    chainWebpack: (config) => {
        config.resolve.alias
            .set('@', resolve('src'))
            .set('cps', resolve('src/components'))
    },
    productionSourceMap: process.env.NODE_ENV !== 'production' // 去除生产环境.map文件
}